package com.syg.controller;

import com.syg.domain.LoanInfo;
import com.syg.event.LoanSuccessEvent;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author syg
 */
@RestController
public class LoanController {

    @Resource
    private ApplicationContext applicationContext;

    @RequestMapping("/testListener")
    public String testListener() {
        LoanInfo loan = new LoanInfo();
        loan.setLoanName("借据名称");
        loan.setLoanNo("借据编号");
        applicationContext.publishEvent(new LoanSuccessEvent("这个source有什么有用", loan));
        return "监听";
    }
}
